<%@ page import="com.xpmusic.model.MusicInfo" %>
<%@ page import="java.util.List" %>
<%@ page import="com.xpmusic.dao.impl.MusicDaoImpl" %><%--
  Created by IntelliJ IDEA.
  User: 纯牛奶丶
  Date: 2018/1/2
  Time: 15:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>个人音乐</title>
    <link rel="icon" href="img/icon.ico">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
    <link rel="stylesheet" href="./css/personalMusic.css">
    <%
        String downURL = request.getContextPath() + "/downLoadServlet?musicName=";
        String infoURL = request.getContextPath() + "/toPlayMusic.jsp?musicName=";
        String loginName = (String) session.getAttribute("loginName");
        if(loginName == null || loginName.equals("")){
            request.getRequestDispatcher("toLogin.jsp").forward(request, response);
            return;
        }
    %>
</head>
<body>
<div id="leftSide">
    <ul>
        <li class="fnt1"><a href="index.jsp">M</a></li>
        <li><a href="index.jsp"><img src="img/house1.png" alt=""><span>Home</span></a></li>
        <li><a href="personalMusic.jsp"><img src="img/music.png" alt=""><span>音乐馆</span></a></li>
        <li><a href="userLogin.jsp"><img src="img/login.png" alt=""><span>登陆</span></a></li>
        <li><a href="userRegister.jsp"><img src="img/register.png" alt=""><span>注册</span></a></li>
        <li><a href="adminLogin.html"><img src="img/admin.png" alt=""><span>管理员</span></a></li>
    </ul>
</div>
<div id="box">
    <div class="header">
        <section class="header_1">
            <img src="img/musicLogo.png" alt="">
        </section>
        <section class="header_2">
            <ul id="nav">
                <li><a href="#">音乐馆</a></li>
                <li><a href="#">我的音乐</a></li>
            </ul>
        </section>
        <section class="header_3">
            <input type="text" placeholder="我们不一样">
            <i class="icon_search"></i>
        </section>
        <section class="header_4">
            <span><%=loginName%></span>的音乐
        </section>
    </div>
    <div class="middle">
        <section class="handle">
            <div class="form-group">
                <input type="button" class="btn btn-success" value="播放全部">
                <input type="button" class="btn btn-warning" value="添加到">
                <input type="button" class="btn btn-info" value="下载">
                <input type="button" class="btn btn-danger" value="批量操作">
            </div>
        </section>
        <section class="musicInfo">
            <table style="width: 1400px">
                <tr>
                    <td>歌名</td>
                    <td>歌手</td>
                    <td>专辑</td>
                    <td>下载</td>
                </tr>
                <%
                    List<MusicInfo> musicInfos = new MusicDaoImpl().getAllMusic();
                    for(MusicInfo m : musicInfos){
                %>
                <tr>
                    <td>
                        <a class="td_a" target="_blank" href="<%=infoURL + m.getMusicName()+"&musicPath="+m.getMusicPath()+"&musicPic="+m.getMusicPic()+"&musicInfo="+m.getMusicInfo()+"&singer="+m.getSinger()%>"><%=m.getMusicName()%></a>
                        <%--<%session.setAttribute("musicInfo",m);%>--%>
                        <%--<audio src="<%=m.getMusicPath()%>" controls="controls" class="music" style="color: #0096e6"></audio>--%>
                    </td>
                    <td>
                        <%=m.getSinger()%>
                    </td>
                    <td>
                        <%=m.getMusicInfo()%>
                    </td>
                    <td>
                        <%--<img src="<%=m.getMusicPic()%>" alt="图片不见啦!" class="img">--%>
                        <a href="<%=downURL + m.getMusicPath().split("/")[2]%>">下载歌曲</a>
                    </td>
                </tr>
                <%
                    }
                %>
            </table>
        </section>
        <section class="pages">
            <span>占位区，分页栏</span>
        </section>
    </div>
</div>
</body>
</html>
